<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 100px;
            height: 100px;
            border-radius: 50%;
            background: skyblue;
            position:absolute;
        }
    </style>
</head>
<body>
    <div></div>
    <script>
        var divDom = document.querySelector("div");
        divDom.onmousedown = function(e){
            // var event = e || window.event;
            divDom.onmousemove = function(e){
                var event = e || window.event;
                var x = event.clientX - 50;
                var y = event.clientY - 50;
                divDom.style.top = y + "px"
                divDom.style.left = x + "px"
            }
        }
        divDom.onmouseup = function(){
            divDom.onmousemove = null
        }
    </script>
</body>
</html>